package com.yjzx.util.binlog.core.entiry.recordIndex;

import com.yjzx.util.binlog.core.util.StringUtils;

/**
 * @author yjzx
 * @date 2024/11/18
 * @description MemoryBinLogIndex
 */
public class MemoryRecordBinLogIndex extends BinaryLogClientIndex{

    public MemoryRecordBinLogIndex(String binFile, long position) {
        super(binFile,position);
    }

    @Override
    public int getOrder() {
        return 1;
    }

    @Override
    public boolean valid() {
        return StringUtils.isNotBlank(binFileName) &&  position > 0;

    }

    @Override
    public boolean isRead() {
        return true;
    }

    /**
     * 因内存中写入信息重启后丢失，不建议使用内存写入当前索引
     * @return
     */
    @Override
    public boolean isWrite() {
        return false;
    }

    @Override
    public void writeBinlogIndex(String binlogIndex) {

    }

}
